const {request}=require('./request')


module.exports={

  //请求轮播图
  getappbannerApi(type='app') {
    return request('banner/list','GET',{type:type})
  },

  // 请求首页轮播
  getbannerApi(type='index') {
    return request('banner/list','GET',{type:type})
  },

  // 首页nav栏
  getnavApi(){
    return request('shop/goods/category/all','GET')
  },

  // 首页公告栏
  getnoticeApi(){
    return request('notice/last-one','GET')
  },

  // 首页秒杀
  getmiaoshaApi(data){
    return request('shop/goods/list/v2','POST',data)
  },

  // 首页秒杀
  getbaopinApi(data){
    return request('shop/goods/list/v2','POST',data)
  },

  // 首页砍价
  getkanjiaApi(data){
    return request('shop/goods/list/v2','POST',data)
  },

  // 首页拼团
  getpintuanApi(data){
    return request('shop/goods/list/v2','POST',data)
  },

  // 商品列表
  getallApi(data){
    return request('shop/goods/list/v2','POST',data)
  },

  // 商品详情
  getdetailsApi(id){
    return request('shop/goods/detail','GET',id)
  },

  // 分类左侧
  getcartapi() {
    return request('shop/goods/category/all', 'GET')
  },

  // 分类右侧
  getcartgoosapi() {
    return request('shop/goods/list/v2', 'POST')
  },

  // 搜索切换排序接口
  getOrderByApi(data){
    return request('shop/goods/list/v2','POST',{orderBy:data})
  },

  //判断token是否有效
  checkTokeValidApi(token) {
    return request('user/check-token','GET',{token})
  },
  //自动注册与登录接口
  authRegAndLoginApi(code) {
    return request('user/wxapp/authorize','POST',{code})
  },
  //查询用户详情
  getUserDetailApi(token) {
    return request('user/detail','GET',{token})
  },
  //更新用户信息接口
  /**
   * 
   * @param {Object} data  {city,nick,province,avatarUrl,gender,token}
   */
  updateUserApi(data) {
    return request('user/modify','POST',data)
  },
  //加入购物车 
  goodsapi(data) {
    return request('shopping-cart/add', 'POST', data)
  },
  // 渲染购物车
  cartapi(toekn) {
    return request('shopping-cart/info', 'GET', toekn)
  },
}